<?php
//ref: http://devzone.zend.com/article/3450 decorators etc.

	class Default_Form_Backend_SiteLinks extends Default_Form_Common
	{
	    public function init()
	    {
			parent::init();
	    }

		public function add()
	    {

			$name = $this->createElement('text', 'name');
			$name->setLabel('sitelinks:Name')
	               	//->setRequired(true)
	               	->setAttrib('size', 60)
	               	->addValidator('stringLength', false, array(3, 120))
	               	->addFilter('StripTags')
	               	//->addFilter('StringTrim')
	               	;

			$label = $this->createElement('text', 'label');
			$label->setLabel('sitelinks:Label')
	               	//->setRequired(true)
	               	->setAttrib('size', 60)
	               	->addValidator('stringLength', false, array(3, 120))
	               	->addFilter('StripTags')
	               	//->addFilter('StringTrim')
	               	;

			$moduleName = $this->createElement('text', 'module_name');
			$moduleName->setLabel('sitelinks:Module name')
	               	->setRequired(true)
	               	->setAttrib('size', 50)
	               	->addValidator('stringLength', false, array(3, 120))
	               	->addFilter('StripTags')
	               	//->addFilter('StringTrim')
	               	;

			$controllerName = $this->createElement('text', 'controller_name');
			$controllerName->setLabel('sitelinks:Controller name')
	               	->setRequired(true)
	               	->setAttrib('size', 50)
	               	->addValidator('stringLength', false, array(3, 120))
	               	->addFilter('StripTags')
	               	//->addFilter('StringTrim')
	               	;

			$actionName = $this->createElement('text', 'action_name');
			$actionName->setLabel('sitelinks:Action name')
	               	->setRequired(true)
	               	->setAttrib('size', 50)
	               	->addValidator('stringLength', false, array(3, 120))
	               	->addFilter('StripTags')
	               	//->addFilter('StringTrim')
	               	;

	        $model = new Default_Model_DbTable_Role();
	        $roles = $model->getRolesAsPairs();
	        $roleName = $this->createElement('select', 'role_name');
			$roleName->setLabel('sitelinks:Role name')
			         ->setRequired(true)
			         ->addMultiOption('', 'select-label')
			         ->addMultiOptions($roles)
			         ;

	        $isActive = $this->createElement('checkbox', 'is_active');
			$isActive->setLabel('is-active');


			$this->addElement($name)
			     ->addElement($label)
			     ->addElement($roleName)
			     ->addElement($moduleName)
			     ->addElement($controllerName)
			     ->addElement($actionName)
			     ->addElement($isActive)
			     ;



	    }

		public function edit()
	    {
	    	$this->add();

			$editId = $this->createElement('hidden', 'id');

			$this->addElement($editId);


	    }

	}
